<?php 
require("dbcon.php");
$id=(isset($_GET['id']))?$_GET['id']:0;
if(empty($_POST)){
$sql="select * from tb_emp where e_id='{$id}'";
$kis=$db->query($sql);
$edis=$kis->fetch_array();
 require "edis_html.php";
    }else{
        $name=$_REQUEST['e_name'];
        $dept=$_REQUEST['e_dept'];
        $img=$_REQUEST['e_img'];
        $of_birth=$_REQUEST['date_of_birth'];
        $of_entry=$_REQUEST['date_of_entry'];
        $sql="update tb_emp set e_name='$name',e_dept='$dept',e_img='$img',date_of_birth='$of_birth',date_of_entry='$of_entry' where e_id='$id'";
        $rs=$db->query($sql);
 if($rs==true){
     header("Location:index.php");
}else{
      echo "<script language='javascript'>";
           echo "alert('修改失败！');";
           echo "window.location.href='index.php';";
           echo "</script>";
}
    }